package xx.adapter.design;

/**
 * @Classname Client
 * @Description TODO 客户端代码
 * @Date 2023/7/25 09:06
 * @Created by wangxianlin
 */
public class Client {
    public static void main(String[] args) {
        Voltage5V adapter = new VoltageAdapterNew(new Voltage220V());
        int output5V = adapter.output5V();
        System.out.println("输出电压：" + output5V + "V");
    }

    /**
     * 类适配器模式
     */
    public static void classAdapter() {
        Voltage5V adapter = new VoltageAdapter();
        int output5V = adapter.output5V();
        System.out.println("输出电压：" + output5V + "V");
    }

    /**
     * 对象适配器模式
     */
    public static void objectAdapter() {
        Voltage5V adapter = new VoltageAdapterNew(new Voltage220V());
        int output5V = adapter.output5V();
        System.out.println("输出电压：" + output5V + "V");
    }
}

